package com.sibbay.syncbox.adapter;

import com.sibbay.syncbox.adapter.box.BoxSyncAdapterSynchronous;

import android.content.Context;

public abstract class SyncAdapterSynchronous {
	
	protected static final String ROOT_DIRECTORY = "DroidSyncBox";

	protected final Context mContext;
	protected String mAccountName;
	
	protected SyncAdapterSynchronous(final Context context) {
		mContext = context.getApplicationContext();
	}
	
	private static volatile SyncAdapterSynchronous sSyncAdapter;
	
	public static SyncAdapterSynchronous getInstance(final Context context) {
		if (sSyncAdapter == null) {
			sSyncAdapter = new BoxSyncAdapterSynchronous(context);
		}
		return sSyncAdapter;
	}
	
	//
	
	public String getAccountName() {
		return mAccountName;
	}
	
	// interfaces
	public abstract void authenticate();
	// RemoteFileAdaptor is valid after authentication only
	public abstract RemoteFileAdaptor getRemoteFileAdaptor();
	
	// 
	public interface RemoteFileAdaptor {
		boolean isExist(final String name);
		boolean makeDirectory(final String name);
		boolean makeFile(final String name);
	}
}
